package com.curso.sesion10;
import java.io.*;
   public class DeserializeDemo {
      public static void main(String [] args) {
         Employee e = null;
         FileInputStream fileIn = null;
         ObjectInputStream in = null;
         try {
            fileIn = new FileInputStream("E:\\Cesar\\CursoJava\\employee.ser");
            in = new ObjectInputStream(fileIn);
            e = (Employee) in.readObject();
        } catch(IOException i) {
        	System.out.println(".File not found.");
        	i.printStackTrace();
            return;
        } catch(ClassNotFoundException c) {
            System.out.println(".Employee class not found.");
            c.printStackTrace();
            return;
        } finally {
        	try {
      		  if (in != null) {
      			  in.close();    			  
      		  }
      		  if (fileIn != null) {
      			  fileIn.close(); 
      		  }
      	  } catch (IOException e1) {
      		  e1.printStackTrace();
      	  }
        }
        System.out.println("Deserialized Employee...");
        System.out.println("Name: " + e.name);
        System.out.println("Address: " + e.address);
        System.out.println("SSN: " + e.SSN);
        System.out.println("Number: " + e.number);
    }
}